package com.panda.pandawash.adapter;

import java.util.List;
import java.util.Map;

import org.w3c.dom.Text;

import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.panda.pandawash.R;

import java.util.List;
import java.util.Map;

public class AdapterPopWindowList extends BaseAdapter {

	private List<Map<String, Object>> data;
	private Context mContext;
	private LayoutInflater mInflater;

	public AdapterPopWindowList(List<Map<String, Object>> data, Context mContext) {
		this.mInflater = LayoutInflater.from(mContext);
		this.data = data;
		this.mContext = mContext;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return data.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		ViewHolder mViewHolder;
		
		if (convertView == null) {
			mViewHolder = new ViewHolder();
			convertView = mInflater.inflate(R.layout.item_popwindow_products, null);
			mViewHolder.devicesName = (TextView) convertView.findViewById(R.id.device_name);
			convertView.setTag(mViewHolder);
		}else {
			mViewHolder = (ViewHolder) convertView.getTag();
		}
		mViewHolder.devicesName.setText(data.get(position).get("device_name").toString());

		return convertView;
	}
	
	public static final class ViewHolder{
		TextView devicesName;
	}

}
